package cn.itsource.pethome.org.domain;

import cn.itsource.pethome.base.domain.BaseDomain;
import cn.itsource.pethome.base.domain.BaseTreeNode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "t_department")
public class Department  extends BaseTreeNode<Department>  implements BaseDomain {
    @Id
    @GeneratedValue(generator = "JDBC")
    private  Long id;
    @NotBlank(message = "部门编号必填")
    private  String sn;
    @NotBlank(message = "部门经理必填")
    private  String name;
//    状态 0 正常  1禁用
    private  Integer state;
//    关联的部门经理id
    private Long managerId;
//    关联的上级部门id
    private Long parentId;
    //部门级联路径
    private String dirPath;
    //true 表示未删除,flase是删除
    private Boolean del;
//    关联的部门经理
    //@Transient 让tkmapper 忽略当前字段
    @Transient
    private Employee manager;
//    上级部门 parent
    @Transient
    private Department parent;
    @Transient
    private List<Department> children;
}
